import PO.DuoShangPage;
import com.epwk.action.Action;
import com.epwk.action.JSExecutor;
import com.epwk.action.MouseAction;
import com.epwk.driver.SeleniumDriver;
import Action.*;
import com.epwk.element.WebEle;
import com.epwk.element.WebEles;
import com.epwk.logger.LoggerControler;
import com.epwk.tools.DateFormat;
import com.epwk.tools.ExcelUtil;
import com.epwk.tools.RandomNum;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import static com.epwk.driver.SeleniumDriver.driver;

/**
 * Created by Administrator on 2016/11/21.
 */
public class test {
    final static LoggerControler log = LoggerControler.getLogger(test.class);
    WebDriver driver;

    @BeforeMethod
    public void openBrowser() {
        driver = SeleniumDriver.openBrowser("chrome", "http://www.epwk.us/release.html");
        SeleniumDriver.maxBrowser();
//        driver = SeleniumDriver.openBrowser("chrome");
    }

    @Test
    public void test() throws InterruptedException {

//        JSExecutor.jsExecutor("var q=document.documentElement.scrollTop=1300");
//
//        Action.click(DuoShangPage.model_xs);
//        Action.sendkeys(DuoShangPage.cash_xs,"1000");
//        Action.click(DuoShangPage.duoshang);
//
////        中标人数
        int winNum = 5;
        int[] cashs = {400,300,100,60,40};
//        MouseAction.selectValue(DuoShangPage.winNum,winNum-2);
//
//        List<WebElement> eles = driver.findElements(DuoShangPage.cash_n);
//        for (int i = 0; i < eles.size(); i++) {
//            eles.get(i).sendKeys(String.valueOf(cashs[i]));
//        }
//
//        SelectedNum.selectedNum(3);


        DuoShang.duoShang(1000,winNum,cashs,3,30);

    }

    @Test
    public void time() {
//        Date dNow = new Date();   //当前时间
//        Date dBefore = new Date();
//        Calendar calendar = Calendar.getInstance(); //得到日历
//        calendar.setTime(dNow);//把当前时间赋给日历
//        calendar.add(Calendar.DAY_OF_MONTH, 3);  //设置为前一天
//        dBefore = calendar.getTime();   //得到前一天的时间
//        System.out.println(dBefore);

        DateFormat.beforeORLateDate(30, DateFormat.COMMON_DATE_FORMAT);

    }


//    @AfterMethod
//    public void closeBrowser(){
//        SeleniumDriver.closeBrowser();
//    }
}
